/*大屏抽奖*/
import request from '@/utils/request';
import {object2Url} from "@/utils/trans";


// 新增大屏
export async function addLargeScreen(data) {
  const res = await request.post('/business/largeScreen/add', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 查询大屏详情传id
export async function lookScreenDetail(data) {
  const res = await request.post('/business/largeScreen/pageList', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

export async function screenChckPage(data) {
  const res = await request.post('/business/largeScreen/chckPage', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}



// 查询大屏统计数
export async function screenCount(data) {
  const res = await request.post('/business/largeScreen/pageCount', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}




// 分页查询大屏 有条件传条件参数
export async function queryLargeScreen(data) {
  const res = await request.post('/business/largeScreen/page', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 删除大屏 ids
export async function delLargeScreen(data) {
  const res = await request.post('/business/largeScreen/delete', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}



/*大屏抽奖页 api—— start*/

// 查询大屏里面的参与人数
export async function queryJoinNum(data) {
  const res = await request.post('/business/largeScreenCheck/pageList', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 查询大屏里面的中奖人数  传largeScreenId(大屏id)
export async function queryWinnerNum(data) {
  const res = await request.post('/business/largeScreenWinners/pageList ', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 大屏抽奖接口  传largeScreenId(大屏id)
export async function onlineLottery(data) {
  const res = await request.post('/business/largeScreen/onlineLottery', data);
  if (res.data.code === 2000) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/*大屏抽奖页 end*/

